🌐 [translation-sync] [need_for_speed.md] Update np.random → Generator API#119
Conversation
✅ Deploy Preview for majestic-griffin-10b166 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Translation Quality ReviewVerdict: PASS | Model: claude-sonnet-4-6 | Date: 2026-05-05 📝 Translation Quality
Summary: The translation of the 'Vectorization vs pure Python loops' section is generally accurate and well-formatted. Terminology follows the reference glossary correctly. Minor fluency issues exist around the phrasing of 'non-vectorized code' and the step description 'draw n uniforms', which could be expressed more naturally in Persian. The inline English code comment is left untranslated, which may be intentional but is worth flagging for consistency. Technical terminology is consistently and correctly applied throughout the changed section, matching the reference glossary (e.g., 'برداریسازی' for Vectorization, 'حلقه' for loop). The MyST/Markdown formatting, including code cells, directives, and list structures, is fully preserved in the changed section. The overall structure and meaning of the 'Vectorization vs pure Python loops' section is accurately conveyed, including the three-step breakdown of the vectorized operation. Suggestions:
🔍 Diff Quality
Summary: The translation correctly mirrors the source change, replacing the old vectorized code block with the new RNG-based implementation in the same position, with no structural or metadata issues. This review was generated automatically by action-translation review mode. |
There was a problem hiding this comment.
Pull request overview
Syncs the Persian translation of need_for_speed.md with upstream changes that migrate an example from the legacy np.random API to the newer numpy.random.Generator API, keeping the translated lecture aligned with the source repository.
Changes:
- Updated the NumPy vectorization example to create a
rng = np.random.default_rng()and userng.uniform(...)instead ofnp.random.uniform(...). - Updated translation sync state metadata (
source-sha,synced-at) forneed_for_speed.md.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| lectures/need_for_speed.md | Updates the random sampling example to use NumPy’s Generator API (default_rng + rng.uniform). |
| .translate/state/need_for_speed.md.yml | Updates translation sync tracking metadata to reflect the new upstream source revision and sync date. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…le -W (#137) * Migrate translation workflows to @v0, adopt the review template, enable -W Moves review and rebase off the exact `@v0.16.1` pin onto the floating `@v0` tag, per the pin policy settled in QuantEcon/project-translation#9, and aligns the review workflow with the upstream template in action-translation docs/user/tutorials/connect-existing.md. Two substantive changes beyond the pin: **Concurrency moves from workflow level to job level**, and `cancel-in-progress` from false to true. The previous comment argued that job-level `true` was unsafe because an 'automated' label event would cancel the in-flight review for 'action-translation' and then skip its own job via the filter, leaving no review at all. That was reasoned from the GitHub docs and never tested, and production disproved it: across roughly 15 live opportunities on lecture-intro.zh-cn the group was entered only after the `if` passed, the 'automated' event skipped without cancelling, and a review was posted every time. The stale rationale is replaced rather than left in place. **A `permissions` block is added** — v0.17.0's review dedupe deletes superseded comments, which requires `pull-requests: write`. The pin was two releases behind, which matters here: v0.18.0 carries the fix for a review-mode defect where a model response missing a criterion score became NaN and rendered as an automatic FAIL on otherwise clean PRs. See QuantEcon/action-translation#102. Separately, `ci.yml` gains `-W` on the notebook build. This repo's publish.yml already builds strict, so the PR gate was weaker than the publish gate — a corrupted sync could merge green and then break the published site. Coverage is 26 of 26 lectures with a `_toc.yml` identical to source, so there are no untranslated-lecture references for the flag to trip on. The strict build is the last line of defence against the silent-corruption class in QuantEcon/action-translation#118 and #119, both of which surfaced only because a downstream repo built with -n -W. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Rebase: also match resync/* branches (action-translation v0.18.1) The rebase workflow only fired for `translation-sync-*` branches, which the Action's sync mode creates. The CLI's `translate forward --github` creates `resync/{stem}` branches, so merging one resync PR never rebased its siblings — during a drift-recovery wave that leaves a stack of open PRs whose bases go stale with every merge. Fixed engine-side in action-translation v0.18.1, but the action-side half is not sufficient on its own: this `if` gates whether the job runs at all, and it runs before the action does. Both layers must list both prefixes or the result is a job that never starts. Brings this file in step with the upstream template as of that release. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Automated Translation Sync
This PR contains automated translations from QuantEcon/lecture-python-programming.
Source PR
#545 - [need_for_speed.md] Update np.random → Generator API
Files Updated
lectures/need_for_speed.md.translate/state/need_for_speed.md.ymlDetails
This PR was created automatically by the translation action.